//
//  OAAccountSecurityDeleteVC.m
//  OA项目
//
//  Created by innofive on 2018/4/12.
//  Copyright © 2018年 inno. All rights reserved.
//

#import "OAAccountSecurityDeleteVC.h"
#import "OAMeCenterCell.h"
#import "UIBarButtonItem+Extension.h"
@interface OAAccountSecurityDeleteVC ()

@end

@implementation OAAccountSecurityDeleteVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSArray *arr  = @[
                      @[
                          @{@"anQuan":@"1",
                            @"title":@"账号安全"
                            },
                          @{@"anQuan":@"1",
                            @"title":@"开启账号保护后,在不常用额手机上登录系统,需要通过短信验证你的手机号码"
                            }
                          ],
                      @[ @{@"anQuan":@"1",
                           @"title":@"账号安全"
                           },]
                      ];
    
    [self.dataArr addObjectsFromArray:arr];
    
    
    
    UIBarButtonItem *rightItem =[UIBarButtonItem OnCreateBarBtnItemName:@"编辑" BarBtnstyle:(RightBarBtnItemStyle) Btntag:10 target:self action:@selector(onRightButton:)];
    UIButton *button = (id)[rightItem.customView viewWithTag:10];
//    [button setNormalTitleColor:[UIColor blackColor]];
//    [button setSelectTitle:@"完成"];
//    button.titleLabel.font = kSysFont(kFitW(13));
    self.navigationItem.rightBarButtonItem = rightItem;
    
}

-(void)onLoadViewByWillAppear:(UITableView *)view
{
//    view.backgroundColor = hexCOLOR(@"F1F1F1");
    view.separatorStyle = UITableViewCellSeparatorStyleNone;
}



-(void)onRightButton:(UIButton *)button
{
//    button.selected = !button.selected;
    
//    self.tableView.editing =button.selected;
    
    
}


#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return self.dataArr.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return [self.dataArr[section] count];
    
}


-(MCCellInfo *)tableView:(UITableView *)tableView cellForIndexPath:(NSIndexPath *)indexPath IsHeight:(BOOL)isheight
{
    if (indexPath.section==1) {
         return [MCCellInfo configForCellId:cell2 Class:[OAMeCenterCell4 class] Height:kFitH(50) TableView:tableView CellStyle:(UITableViewCellStyleSubtitle)];
    }else
    {
        if (indexPath.row==0) {
             return [MCCellInfo configForCellId:cell Class:[OAMeCenterCell2 class] Height:kFitH(50) TableView:tableView];
        }
        return [MCCellInfo configForCellId:cell1 Class:[OAMeCenterCell3 class] UpdateHeight:^CGFloat(NSString *cellId, UITableView *tableView, NSIndexPath *indexPath) {
            CGFloat h = [NSString calculateLabelHeight:@"开启账号保护后,在不常用额手机上登录系统,需要通过短信验证你的手机号码" font:kSysFont(kFitW(12)) AndWidth:kScreenW-kFitW(30)];
            return h+kFitH(15);
        } TableView:tableView forIndexPath:indexPath IsBian:isheight];
    }
}

-(MCHFViewInfo *)tableView:(UITableView *)tableView HeaderInSection:(NSInteger)section isBiao:(BOOL)isBiao
{
    if (section==0) {
    return [MCHFViewInfo configForViewId:header Class:[OAMeCenterheaderView class] Height:kFitH(10) TableView:tableView IsBian:NO];
    }
    return [MCHFViewInfo configForViewId:header1 Class:[OAMeCenterheaderView1 class] Height:kFitH(30) TableView:tableView IsBian:NO];
    
    
}

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==1) {
        return UITableViewCellEditingStyleDelete;
    }
    return UITableViewCellEditingStyleNone;
}

- (nullable NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return @"删除";
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    
}


-(id)modelForIndexPath:(NSIndexPath *)indexPath
{
    return self.dataArr[indexPath.section][indexPath.row];
};

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
